using System;

namespace PluginScheduler.Interfaces
{
    public interface IJobExecutionContext
    {
        ITrigger Trigger { get; }

        IJobDetail JobDetail { get; }

        IJob JobInstance { get; }

        /// <summary>
        /// The actual time the trigger fired. For instance the scheduled time may
        /// have been 10:00:00 but the actual fire time may have been 10:00:03 if
        /// the scheduler was too busy.
        /// </summary>
        /// <returns> Returns the fireTime.</returns>
        /// <seealso cref="ScheduledFireTime" />
        DateTimeOffset? FireTime { get; }

        /// <summary> 
        /// The scheduled time the trigger fired for. For instance the scheduled
        /// time may have been 10:00:00 but the actual fire time may have been
        /// 10:00:03 if the scheduler was too busy.
        /// </summary>
        /// <returns> Returns the scheduledFireTime.</returns>
        /// <seealso cref="FireTime" />
        DateTimeOffset? ScheduledFireTime { get; }

        /// <summary>
        /// Gets the previous fire time.
        /// </summary>
        /// <value>The previous fire time.</value>
        DateTimeOffset? PreviousFireTime { get; }

        /// <summary>
        /// Gets the next fire time.
        /// </summary>
        /// <value>The next fire time.</value>
        DateTimeOffset? NextFireTime { get; }

        string FireInstanceId { get; }

        /// <summary>
        /// Returns the result (if any) that the <see cref="IJob" /> set before its 
        /// execution completed (the type of object set as the result is entirely up 
        /// to the particular job).
        /// </summary>
        object Result { get; set; }

        /// <summary> 
        /// The amount of time the job ran for.  The returned 
        /// value will be <see cref="TimeSpan.MinValue" /> until the job has actually completed (or thrown an 
        /// exception), and is therefore generally only useful to 
        /// </summary>
        TimeSpan JobRunTime { get; }
    }
}